import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 引入mockjs代码执行
import '@/mock/mockServe'
// 引入表单验证代码执行
import '@/until/validate'

// 全局引入接口函数
import * as api from '@/api'  //引入之后在Vue的原型上添加$api就是引入进来的api对象

// 图片懒加载
import VueLazyload from 'vue-lazyload'
import loadImg from '@/assets/loading.jpg'
Vue.use(VueLazyload, {
  loading: loadImg
})


// 全局注册导航栏，全局都可以直接使用
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import PageNation from '@/components/PageNation'

import { Button, MessageBox } from 'element-ui'
Vue.use(Button)
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(PageNation.name, PageNation)


Vue.config.productionTip = false

new Vue({
  beforeCreate() {
    Vue.prototype.$bus = this,
    Vue.prototype.$api = api
  },
  router,
  store,
  render: h => h(App),
}).$mount('#app')
